/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
*/
package cmd

import (
	"os"

	"github.com/spf13/cobra"
)

const (
	_desc_root     = "GPIO 操作工具"
	_desc_info     = "GPIO 获取指定编号信息"
	_desc_setvalue = "GPIO 设置指定编号值"
	_desc_getvalue = "GPIO 获取指定编号值"
	_desc_getmode_ = "GPIO 获取指定编号模式"
	_desc_setmode_ = "GPIO 设置指定编号模式"
	// Export the specified gpio device
	_desc_export = "导出指定的gpio设备"
	// UnExport the specified gpio device
	_desc_unexport = "取消导出指定的gpio设备"
	_desc_fastmode = "快速执行操作"
	_desc_setedge  = "GPIO 设置触发方式"
	_desc_getedge  = "GPIO 获取触发方式"
)

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
	Use:   "gpio-ctl",
	Short: _desc_root,
	Long:  ``,
	// Uncomment the following line if your bare application
	// has an action associated with it:
	// Run: func(cmd *cobra.Command, args []string) { },
}

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
	err := rootCmd.Execute()
	if err != nil {
		os.Exit(1)
	}
}

func init() {
	// Here you will define your flags and configuration settings.
	// Cobra supports persistent flags, which, if defined here,
	// will be global for your application.

	// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.gpio-led.yaml)")

	// Cobra also supports local flags, which will only run
	// when this action is called directly.
	// rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")

	rootCmd.AddCommand(&cobra.Command{
		Use:    "completion",
		Hidden: true,
	})
}
